stage.set_axis(100)
stage.create_grid_overlay(10, "grey")
stage.set_background("soccerfield")
ballx = -80
bally = random.randint(-100,100)
# sprite = codesters.Sprite("image", x, y)
ball = codesters.Sprite("soccerball", ballx, bally)
netx = 90
nety = random.randint(-100,100)
# sprite = codesters.Sprite("image", x, y)
sprite = codesters.Sprite("soccernet", netx, nety)
t = codesters.Teacher()
try:
tval1 = net.get_name()
except:
tval1 = "DNE"
try:
tval2 = net.get_flip()
except:
tval2 = "DNE"
t1 = TestObjective()
t1.add_success(tval1 == "soccernet", "Great job!")
t1.add_failure(tval1 == "DNE", "Did you change the soccernet's name to net?")
t1.add_creative(tval1 != "soccernet" and "net" in tval1 , "That sprite is cool too!")
t2 = TestObjective()
t2.add_success(tval2 is True, "Great Job!")
t2.add_failure(tval2 is False, "Did you flip the sprite?")
tester = TestManager()
tester.add_test_list([t1, t2])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)